<?php
class Game_getPlatformByGame {

	function getPlatformByGame($game) {
		
		$readByConf = MooConfig::get('main.readByConf');
		
		// 走配置
		if ($readByConf && $readByConf == 1) {
			$res = MooConfig::get('platform.' . $game);
		} else {
			$url = MooConfig::get('main.url.fetch_game');
			$result = MooUtil::curl_send($url);
			$resultArr = MooJson::decode($result, true);
			$gameConf = array();
			if ($resultArr) {
				foreach ($resultArr as $key => $val) {
					$gameConf[$val['game']]['platform'] = explode(',', $val['platform']);
					$gameConf[$val['game']]['channel'] 	= explode(',', $val['channel']);
				}
			}
			$res = $gameConf[$game]['channel'];
		}
		
		return $res;
	}
}